//
//  ShareView.m
//  Arts1
//
//  Created by 孤星晨宇 on 15/9/29.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "ShareView.h"
#import "AllHeader.h"

@implementation ShareView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        _friendView = [[UIView alloc] initWithFrame:CGRectMake(55, 32, 54, 44)];
        _friendView.backgroundColor = [UIColor whiteColor];
        
        // 微信好友分享
        UIImageView *friendView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 54, 44)];
        friendView.image = [UIImage imageNamed:@"WX_frient"];
        [_friendView addSubview:friendView];
        
        UILabel *friend = [[UILabel alloc] initWithFrame:CGRectMake(0,friendView.bottom + 17, 54, 11)];
        friend.text = @"微信好友";
        friend.font = [UIFont systemFontOfSize:11];
        friend.textAlignment = NSTextAlignmentCenter;
        [_friendView addSubview:friend];
        
        //  分享到好友会话的手势
        UITapGestureRecognizer *fTapgeustre = [[UITapGestureRecognizer alloc] init];
        [fTapgeustre addTarget:self action:@selector(shareToFriendList:)];
        [_friendView addGestureRecognizer:fTapgeustre];

        [self addSubview:_friendView];
        
        //  分割线
        UIView *grayView = [[UIView alloc] initWithFrame:CGRectMake(self.width /2.0 -0.3, 20, 0.1, self.height - 40)];
        grayView.backgroundColor = kCustomColor(150, 150, 170, 0.5);
        [self addSubview:grayView];
        
        
        _momentsView = [[UIView alloc] initWithFrame:CGRectMake(self.width - 96, _friendView.top, 41, 41)];
        _momentsView.backgroundColor = [UIColor whiteColor];
        
        // 微信朋友圈分享
        UIImageView *momentsView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0,  41, 41)];
        momentsView.image = [UIImage imageNamed:@"WX_moments"];
        [_momentsView addSubview:momentsView];
        
        
        UILabel *moments = [[UILabel alloc] initWithFrame:CGRectMake(momentsView.left, momentsView.bottom + 18, 41, 11)];
        moments.text = @"朋友圈";
        moments.font = [UIFont systemFontOfSize:11];
        moments.textAlignment = NSTextAlignmentCenter;
        [_momentsView addSubview:moments];
        
        // 分享到朋友圈的手势
        UITapGestureRecognizer *mTapgeustre = [[UITapGestureRecognizer alloc] init];
        [mTapgeustre addTarget:self action:@selector(shareToMoments:)];
        [_momentsView addGestureRecognizer:mTapgeustre];
        
        
        [self addSubview:_momentsView];
        
    }
    return self;
}

//  分享到朋友会话列表
- (void)shareToFriendList:(UITapGestureRecognizer *)tapguester{
    if (_shareblock) {
        _shareblock(0);
    }
}

//  分享到微信朋友圈
- (void)shareToMoments:(UITapGestureRecognizer *)tapguester{
    if (_shareblock) {
        _shareblock(1);
    }
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
